package sctu.edu.java.year2016.team01.chenhong.day20160530.chapter9_2;

/**
 * Created by Administrator on 2016/5/31.
 * 创建一个类，在该类中定义一个方法，并在方法内部创建一个局部内部类，通过局部内部类求两个数乘积，并在外部类中进行测试
 */

import java.util.Scanner;

//外部类
public class Product{


    //外部类方法
    public void f(float i, float j) {


//内部类
        class InnerTwo {

            public float Product;


            //内部类方法
            public float f(float i, float j) {
                float Product = i * j;
                //  System.out.println(i + "*" + j + "=" + Product);

                return Product;

            }


            public void print(float i, float j) {


                InnerTwo g= new InnerTwo();
                System.out.println(i + "*" + j + "=" + g.f(i, j));


            }
        }

        //实例化内部类
        InnerTwo innerTwo= new InnerTwo();
        innerTwo.print(i,j);
    }



    //主函数

    public static void main(String[] args) {

        System.out.println("请输入两个数：");

        Scanner scan = new Scanner(System.in);

        int i = scan.nextInt();
        int j = scan.nextInt();


        Product two = new Product();
        two.f(i,j);




    }

}



